"""Definition of the mkfriends content type
"""

from zope.interface import implements

from Products.Archetypes import atapi
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata
from Products.ATContentTypes.content.newsitem import ATNewsItem,ATNewsItemSchema

# -*- Message Factory Imported Here -*-
from my315ok.xtinfocontent import xtinfocontentMessageFactory as _

from my315ok.xtinfocontent.interfaces import Imkfriends
from my315ok.xtinfocontent.config import PROJECTNAME

mkfriendsSchema = ATNewsItemSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-




    atapi.StringField(
        'name',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"full name"),
            description=_(u""),
        ),
        required=True,
    ),


    atapi.StringField(
        'nickname',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"nick name"),
            description=_(u""),
        ),
    ),


    atapi.ImageField(
        'photo',
        storage=atapi.AnnotationStorage(),
        widget=atapi.ImageWidget(
            label=_(u"photo"),
            description=_(u""),
        ),
        validators=('isNonEmptyFile'),
    ),


    atapi.StringField(
        'idcard',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"id card"),
            description=_(u""),
        ),
        required=True,
    ),


    atapi.StringField(
        'gender',
        storage=atapi.AnnotationStorage(),
        vocabulary_factory=u"my315ok.xtinfocontent.gender",
        enforceVocabulary=True,
        widget=atapi.SelectionWidget(
            label=_(u"gender"),
            description=_(u""),
        ),
    ),


    atapi.DateTimeField(
        'borndate',
        storage=atapi.AnnotationStorage(),
        widget=atapi.CalendarWidget(
            label=_(u"born date"),
            description=_(u""),
        ),
        required=True,
        validators=('isValidDate'),
    ),


    atapi.StringField(
        'weddingstatus',
        storage=atapi.AnnotationStorage(),
        vocabulary_factory=u"my315ok.xtinfocontent.weddingstatus",
        enforceVocabulary=True,
        widget=atapi.SelectionWidget(
            label=_(u"wedding status"),
            description=_(u""),
        ),
       
    ),


    atapi.StringField(
        'goal',
        storage=atapi.AnnotationStorage(),
        vocabulary_factory=u"my315ok.xtinfocontent.goal",
        enforceVocabulary=True,
        widget=atapi.SelectionWidget(
            label=_(u"goal"),
            description=_(u""),
        ),
    ),


    atapi.StringField(
        'housestatus',
        storage=atapi.AnnotationStorage(),
        vocabulary_factory=u"my315ok.xtinfocontent.housestatus",
        enforceVocabulary=True,
        widget=atapi.SelectionWidget(
            label=_(u"house status"),
            description=_(u""),
        ),
    ),
    atapi.StringField(
        'edustatus',
        storage=atapi.AnnotationStorage(),
        vocabulary_factory=u"my315ok.xtinfocontent.educationstatus",
        enforceVocabulary=True,
        widget=atapi.SelectionWidget(
            label=_(u"education status"),
            description=_(u""),
        ),
    ),


    atapi.StringField(
        'workstatus',
        storage=atapi.AnnotationStorage(),
        vocabulary_factory=u"my315ok.xtinfocontent.workstatus",
        enforceVocabulary=True,
        widget=atapi.SelectionWidget(
            label=_(u"work status"),
            description=_(u""),
        ),
    ),


    atapi.StringField(
        'position',
        storage=atapi.AnnotationStorage(),
        vocabulary_factory=u"my315ok.xtinfocontent.workposition",
        enforceVocabulary=True,
        widget=atapi.SelectionWidget(
            label=_(u"work position"),
            description=_(u""),
        ),
    ),


    atapi.StringField(
        'worktitle',
        storage=atapi.AnnotationStorage(),
        vocabulary_factory=u"my315ok.xtinfocontent.worktitle",
        enforceVocabulary=True,
        widget=atapi.SelectionWidget(
            label=_(u"work title"),
            description=_(u""),
        ),
    ),


    atapi.StringField(
        'workcategory',
        storage=atapi.AnnotationStorage(),
        vocabulary_factory=u"my315ok.xtinfocontent.workcategory",
        enforceVocabulary=True,
        widget=atapi.SelectionWidget(
            label=_(u"work category"),
            description=_(u""),
        ),
    ),


    atapi.StringField(
        'height',
        storage=atapi.AnnotationStorage(),
        vocabulary_factory=u"my315ok.xtinfocontent.bodyheight",
        enforceVocabulary=True,
        widget=atapi.SelectionWidget(
            label=_(u"body height"),
            description=_(u""),
        ),
        
    ),


    atapi.StringField(
        'weight',
        storage=atapi.AnnotationStorage(),
        vocabulary_factory=u"my315ok.xtinfocontent.bodyweight",
        enforceVocabulary=True,
        widget=atapi.SelectionWidget(
            label=_(u"body weight"),
            description=_(u""),
        ),
        required=True,
        
    ),


    atapi.StringField(
        'animal',
        storage=atapi.AnnotationStorage(),
        vocabulary_factory=u"my315ok.xtinfocontent.animal",
        enforceVocabulary=True,
        widget=atapi.SelectionWidget(
            label=_(u"animal"),
            description=_(u""),
        ),
    ),


    atapi.StringField(
        'costellation',
        storage=atapi.AnnotationStorage(),
        vocabulary_factory=u"my315ok.xtinfocontent.cosstellation",
        enforceVocabulary=True,
        widget=atapi.SelectionWidget(
            label=_(u"cosstellation"),
            description=_(u""),
        ),
    ),


    atapi.StringField(
        'bloodgrp',
        storage=atapi.AnnotationStorage(),
        vocabulary_factory=u"my315ok.xtinfocontent.bloodgroup",
        enforceVocabulary=True,
        widget=atapi.SelectionWidget(
            label=_(u"blood group"),
            description=_(u""),
        ),
    ),


    atapi.StringField(
        'salary',
        storage=atapi.AnnotationStorage(),
        vocabulary_factory=u"my315ok.xtinfocontent.salary",
        enforceVocabulary=True,
        widget=atapi.SelectionWidget(
            label=_(u"salary"),
            description=_(u""),
        ),
        
    ),


    atapi.IntegerField(
        'qqnum',
        storage=atapi.AnnotationStorage(),
        widget=atapi.IntegerWidget(
            label=_(u"QQ number"),
            description=_(u""),
        ),
        validators=('isInt'),
    ),


    atapi.IntegerField(
        'mobile',
        storage=atapi.AnnotationStorage(),
        widget=atapi.IntegerWidget(
            label=_(u"mobile phone"),
            description=_(u""),
        ),
        required=True,
        validators=('isInt'),
    ),


    atapi.StringField(
        'workplace',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"workplace"),
            description=_(u""),
        ),
    ),


    atapi.StringField(
        'censusplace',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"census place"),
            description=_(u""),
        ),
    ),


    atapi.StringField(
        'hobby',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"hobby or interesting"),
            description=_(u""),
        ),
        required=True,
    ),


    atapi.TextField(
        'selfintrod',
        storage=atapi.AnnotationStorage(),
        widget=atapi.RichWidget(
            label=_(u"self-introduction"),
            description=_(u""),
        ),
        required=True,
    ),


    atapi.StringField(
        'weddingidea',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"wedding idea"),
            description=_(u""),
        ),
    ),


    atapi.StringField(
        'weddingdeclaration',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"wedding declaration"),
            description=_(u""),
        ),
    ),


))

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

mkfriendsSchema['title'].storage = atapi.AnnotationStorage()
mkfriendsSchema['description'].storage = atapi.AnnotationStorage()
mkfriendsSchema['photo'].widget.visible = 0
mkfriendsSchema['image'].required = False
mkfriendsSchema['text'].widget.visible = 0
mkfriendsSchema['imageCaption'].widget.visible = 0

schemata.finalizeATCTSchema(mkfriendsSchema, moveDiscussion=False)


class mkfriends(ATNewsItem):
    """a content type for making friends"""
    implements(Imkfriends)

    meta_type = "mkfriends"
    schema = mkfriendsSchema
    _at_rename_after_creation = True

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')

    # -*- Your ATSchema to Python Property Bridges Here ... -*-
    edustatus = atapi.ATFieldProperty('edustatus')

    name = atapi.ATFieldProperty('name')

    nickname = atapi.ATFieldProperty('nickname')

    photo = atapi.ATFieldProperty('photo')

    idcard = atapi.ATFieldProperty('idcard')

    gender = atapi.ATFieldProperty('gender')

    borndate = atapi.ATFieldProperty('borndate')

    weddingstatus = atapi.ATFieldProperty('weddingstatus')

    goal = atapi.ATFieldProperty('goal')

    housestatus = atapi.ATFieldProperty('housestatus')

    workstatus = atapi.ATFieldProperty('workstatus')

    position = atapi.ATFieldProperty('position')

    worktitle = atapi.ATFieldProperty('worktitle')

    workcategory = atapi.ATFieldProperty('workcategory')

    height = atapi.ATFieldProperty('height')

    weight = atapi.ATFieldProperty('weight')

    animal = atapi.ATFieldProperty('animal')

    costellation = atapi.ATFieldProperty('costellation')

    bloodgrp = atapi.ATFieldProperty('bloodgrp')

    salary = atapi.ATFieldProperty('salary')

    qqnum = atapi.ATFieldProperty('qqnum')

    mobile = atapi.ATFieldProperty('mobile')

    workplace = atapi.ATFieldProperty('workplace')

    censusplace = atapi.ATFieldProperty('censusplace')

    hobby = atapi.ATFieldProperty('hobby')

    selfintrod = atapi.ATFieldProperty('selfintrod')

    weddingidea = atapi.ATFieldProperty('weddingidea')

    weddingdeclaration = atapi.ATFieldProperty('weddingdeclaration')


atapi.registerType(mkfriends, PROJECTNAME)
